<%@ page contentType="text/html; charset=utf-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>平台管理系统</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="/layuiadmin/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="/layuiadmin/style/admin.css" media="all">
</head>
<body>

<div class="layui-fluid">
    <div class="layui-row layui-col-space12">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-form layui-card-header layuiadmin-card-header-auto">
                    <div class="layui-form-item">
                        <div class="layui-inline">
                            <label class="layui-form-label">查询天数</label>
                            <div class="layui-input-inline">
                                <input type="text" name="timeDays" placeholder="请输入查询天数" autocomplete="off"
                                       class="layui-input" value="${vo.timeDays}">
                            </div>
                        </div>
                        <div class="layui-inline">
                            <label class="layui-form-label">显示数量</label>
                            <div class="layui-input-inline">
                                <input type="text" name="searchNum" placeholder="请输入显示数量" autocomplete="off"
                                       class="layui-input" value="${vo.searchNum}">
                            </div>
                        </div>
                        <div class="layui-inline">
                            <button class="layui-btn layuiadmin-btn-list" lay-submit
                                    lay-filter="LAY-app-contlist-search">
                                <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
                            </button>
                        </div>
                    </div>
                    <div class="layui-card-header">近<span id="changeDay">30</span>天商家交易额TOP<span
                            id="changeNum">10</span></div>
                </div>
                <div class="layui-card-body">
                    <table id="LAY-app-content-list" lay-filter="LAY-app-content-list"></table>
                    <script type="text/html" id="index">
                        {{d.LAY_TABLE_INDEX+1}}
                    </script>
                </div>
            </div>
        </div>
    </div>
</div>

<script src="/layuiadmin/layui/layui.js"></script>
<script>


    layui.config({
        base: '/layuiadmin/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index', 'table'], function () {
        var table = layui.table, form = layui.form;

        table.render({
            elem: '#LAY-app-content-list'
            , url: '/account/queryBusinessTransaction'
            , totalRow: true
            , cellMinWidth: 80 //全局定义常规单元格的最小宽度，layui 2.2.1 新增
            , cols: [[
                {field: 'id', title: '序号', width: 80, fixed: 'left', templet: '#index'},
                {field: 'bid', minWidth: 80, title: '商家编号', sort: true, totalRowText: '小计：'},
                {field: 'tranMoney', minWidth: 80, title: '交易金额', sort: true, totalRow: true},
                {field: 'phone', minWidth: 80, title: '商家账号'},
                {field: 'nickNameOn', title: '商家线上名称', minWidth: 80},
                {field: 'nickName', title: '商家线下名称', minWidth: 80}
            ]]
        });

        //监听搜索
        form.on('submit(LAY-app-contlist-search)', function (data) {
            var field = data.field;
            var timeDays = field.timeDays;
            var searchNum = field.searchNum;
            if (timeDays == null || timeDays == '' || timeDays == undefined) {
                timeDays = 30;
            }
            if (searchNum == null || searchNum == '' || searchNum == undefined) {
                searchNum = 10;
            }
            layui.$('#changeDay').text(timeDays);
            layui.$('#changeNum').text(searchNum);

            //执行重载
            table.reload('LAY-app-content-list', {
                where: field
            });
        });
    });
</script>
</body>
</html>
